#include <iostream>
using namespace std;
int t, n;
int main(){
	cin >> t;
	while(t--){
		cin >> n;
		if (n % 2 == 1){
			cout << (n - 3) / 2 + 1<< endl;
		}
		else cout << (n - 2) / 2 << endl;
	}
	
    return 0;
}


